<?php
/**
 * File: Base.php:YCMS
 * User: xiaoyan f@yanyunfeng.com
 * Date: 15-5-11
 * Time: 下午5:23
 * @Description
 */
define('REQ_TIME',time());
class DataState{
    /**
     * 正常
     * @var int
     */
    static $enable = 1;
    /**
     * 禁用
     * @var int
     */
    static $disable = 0;
    /**
     * 无效
     */
    static $invalid = 2;
    /**
     * 删除
     * @var int
     */
    static $delete = 3;
    static $wait = 4;
    /**
     * 未知
     * @var int
     */
    static $unknown = -1;
    /**
     * 字段类型名称
     * @param $type
     * @return mixed
     */
    public static function getText($type){
        $textArray = self::getState();
        return isset($textArray[$type]) ? $textArray[$type] : $textArray[self::$unknown];
    }
    public static function validate($state){
        $textArray = self::getState();
        return isset($textArray[$state]);
    }

    public static function getState(){
        $textArray = array(
            self::$enable => '正常',
            self::$disable => '禁用',
            self::$unknown => '未知',
            self::$wait => '待处理',
            self::$delete => '删除',
            self::$invalid => '失效'
        );
        return $textArray;
    }
}
class NoticeState{
    /**
     * 正常
     * @var int
     */
    static $enable = 1;
    /**
     * 禁用
     * @var int
     */
    static $disable = 0;
    /**
     * 无效
     */
    static $invalid = 2;
    /**
     * 删除
     * @var int
     */
    static $delete = 3;
    static $wait = 4;
    /**
     * 未知
     * @var int
     */
    static $unknown = -1;
    /**
     * 字段类型名称
     * @param $type
     * @return mixed
     */
    public static function getText($type){
        $textArray = self::getState();
        return isset($textArray[$type]) ? $textArray[$type] : $textArray[self::$unknown];
    }
    public static function validate($state){
        $textArray = self::getState();
        return isset($textArray[$state]);
    }

    public static function getState(){
        $textArray = array(
            self::$enable => '未提醒',
            self::$disable => '禁用',
            self::$unknown => '未知',
            self::$wait => '待处理',
            self::$delete => '删除',
            self::$invalid => '已处理'
        );
        return $textArray;
    }
}

class FieldType{
    static $Text = 'text';
    static $Number = 'number';
    static $Radio = 'radio';
    static $Select = 'select';
    static $TextArea = 'textarea';
    static $DateTime = 'datetime';

    /**
     * 字段类型名称
     * @param $type
     * @return mixed
     */
    public static  function getText($type){
        $textArray = self::getAllType();
        return isset($textArray[$type]) ? $textArray[$type] : $textArray[self::$Text];
    }

    public static function getAllType(){
        $textArray = array(
            self::$Text => '文本框',
            self::$Number => '数字框',
            self::$Radio => '单选按钮',
            self::$Select => '下拉框',
            self::$TextArea => '多行文本框',
            self::$DateTime => '日期'
        );
        return $textArray;
    }
}

class TaskState{
    /**
     * 未跟踪
     * @var int
     */
    static $normal = 1;
    /**
     * 未接
     * @var int
     */
    static $un_connect = 2;
    /**
     * 咨询中
     */
    static $connecting = 3;
    /**
     * 已交定金
     * @var int
     */
    static $booking = 4;
    /**
     * 已上门
     * @var int
     */
    static $up = 7;
    /**
     * 已报名
     * @var int
     */
    static $sign_up = 5;
    /**
     * 无效
     * @var int
     */
    static $invalid = 6;
    /**
     * 字段类型名称
     * @param $type
     * @return mixed
     */
    public static function getText($type){
        $textArray = self::getState();
        return isset($textArray[$type]) ? $textArray[$type] : $textArray[self::$unknown];
    }

    public static function getState(){
        $textArray = array(
            self::$normal => '未跟踪',
            self::$un_connect => '未接',
            self::$connecting => '咨询中',
            self::$booking => '已交定金',
            self::$up => '已上门',
            self::$sign_up => '已报名',
            self::$invalid => '无效'
        );
        return $textArray;
    }
}